package com.tu.tropicana.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class ConnectionManager {

protected Connection connection;
	
	protected Statement statement;
	
	protected ResultSet resultSet;
	
	protected PreparedStatement preparedStatement;

	protected void closeConnection( Connection connection, Statement statement, 
			ResultSet resultSet ){
		
		if(resultSet != null){
			
			try {
				resultSet.close();
			} catch ( SQLException e ) {	
			}
		}
		
		if(statement != null){
			
			try {
				statement.close();
			} catch (SQLException e) {				
			}	
		}
		
		if(connection != null){
			
			try {
				connection.close();
			} catch (SQLException e) {
			}
		}
			
	}
	
	protected void closeConnection( Connection connection, PreparedStatement 
			preparedStatement, ResultSet resultSet ){
		
		if(resultSet != null){
			
			try {
				resultSet.close();
			} catch (SQLException e) {
			}			
		}
		
		if(preparedStatement != null){
			
			try {
				preparedStatement.close();
			} catch (SQLException e) {
			}
		}
		
		if(connection != null){
			
			try {
				connection.close();
			} catch (SQLException e) {
			}
		}
	}
}
